// pages/decoration-knowledge/index.js
const {globalData} = getApp()

Component({
  behaviors: [],
  properties: {
  },
  /**
   * 页面的初始数据
   */
  data: {
    pageList: []
  },
  methods: {
    pageDataHandle(event) {
      let {page, list = []} = event.detail;
      let setData = {}
  
      list = list.map(item => {
        return {
          id: item.id,
          title: item.title,
          introd: item.introd,
          image_path: globalData.imageUrl + item.image_path,
          share_able: item.share_able,
          create_time: item.create_time ? item.create_time.split(' ')[0] : ''
        }
      })
  
      if (page == 1) {
        setData.pageList = [list]
      } else {
        setData[`pageList[${page}]`] = list
      }
  
      this.setData(setData)
    },
    itemClilckHandle(event) {
        console.log(event.detail)
      wx.navigateTo({
        url: `/pages/content-detail/content-detail?pageTitle=装修知识详情&id=${event.detail.id}&share_able=${event.detail.share_able}`,
      })
    }
  }
})